/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package treeship.core.service.impl;

import treeship.core.service.DimensionalFactory;
import treeship.core.ship.space.Position;
import treeship.core.ship.space.Shape;
import treeship.core.ship.space.impl.Position1D;
import treeship.core.ship.space.impl.Shape1D;

/**
 *
 * @author Moonchild
 */
public class DimensionalFactory1D extends DimensionalFactory {

    private static double parametersToDouble(Long shipSeed, Long staticPositionSeed, Shape owner, Shape inner) {
        double double01FromSeeds = seedsTo01Double(shipSeed, staticPositionSeed);
        double d = (owner.getDimension().minus(inner.getDimension()).getValue()) * double01FromSeeds;
        return d;
    }

    @Override
    public Position createPositionFromSeed(Long shipSeed, Long staticPositionSeed, Shape owner, Shape inner) {
        double d = parametersToDouble(shipSeed, staticPositionSeed, owner, inner);
        return new Position1D(d);

    }

    @Override
    public Shape createNewShape() {
        return new Shape1D();
    }
}
